package vis.ds.stack;

import processing.core.PApplet;
import vis.app.VisualObject;

public class Item extends VisualObject {
	private static final int BOX_SIZE = 10;
	private int index;
	private int posX;
	private int posY;
	
	private Object data;

	public Item(PApplet parent, Object obj, int index) {
		super(parent);
		this.data = obj;
		this.index = index;
	}

	@Override
	public void update() {
		posX = StackSketch.WORLD_HEIGHT - this.index * BOX_SIZE;
		posY = 0;
	}

	@Override
	public void display() {
		p.rect(posX, posY, BOX_SIZE, BOX_SIZE);
	}
}
